<?php defined("_JEXEC") or die("Acesso Restrito") ?>
<?php JHTML::_('behavior.modal'); ?>

<script type="text/javascript"> 

</script>  
<form name="formCadastro" action="index.php?option=com_sgrh" method="post">
	<div class="titulosPagina">Gerenciador de Candidatos</div>
	<fieldset>
		<legend>Buscar Candidato:</legend>
		<div class="botaoFinalPagina">
			<div class="iconesForm" >
				<a href="index.php?option=com_sgrh">
					<img alt="" src="components/com_sgrh/auxiliares/imagens/btnNovo.png" />
				</a>
			</div>
			<div class="tituloBotoes">
				Novo
			</div>
		</div>
		<div class="campo">
			<div class="for_label">Nome/CPF:</div>
			<input class="inputbox" type="text" name="cpfNome" id="cpfNome" value="<?php echo $this->busca['cpfNome']; ?>" />
			<input type="hidden" name="controller" value="gerenciador" />
			<button name="task" value="buscar" onclick="submitform()" >
				Buscar
			</button>
		</div>
		<!-- Tabela de Contatos-->
		<div id="editcell">
			<table class="lista">
				<thead>
					<tr>
						<th width="40%">
							<?php echo JText::_('Nome'); ?>
						</th>
						<th width="20%">
							<?php echo JText::_('Cidade'); ?>
						</th>
						<th width="10%">
							<?php echo JText::_('Estado'); ?>
						</th>
						<th width="20%">
							<?php echo JText::_('Email'); ?>
						</th>
						<th width="8%">
							<?php echo JText::_('Contatos'); ?>
						</th>
						<th width="8">
							<?php echo JText::_('Editar'); ?>
						</th>
						<?php if ($this->user->gid == 25 ){?>
						<th width="8%">
							<?php echo JText::_('Remover'); ?>
						</th>
						<?php } ?>
					</tr>
				</thead>
				<?php
				for ($i = 0; $i < count($this->registros); $i++) {
					$row = & $this->registros[$i];
					$endereco = & $this->registrosEndereco[$row->id];
					$pessoa = & $this->idPessoa;
					$link = JRoute::_("index.php?option=com_sgrh&view=detalhes&idPessoa={$row->id}");
					$linkEditar = JRoute::_("index.php?option=com_sgrh&idPessoa={$row->id}");
					$linkDelete = JRoute::_("index.php?option=com_sgrh&controller=candidato&task=apagarPessoa&idPessoa={$row->id}");
					?>

					<tr class="<?php echo "row" . ($i % 2); ?>">
						<td>
							<a href="<?php echo $link ?>">
								<?php echo $row->nome; ?>
							</a>
						</td>
						<td>
							<?php echo $endereco->cidade; ?>
						</td>
						<td>
							<?php echo $endereco->estado; ?>
						</td>
						<td>
							<?php echo $row->email; ?>
						</td>
						<td>
							<div class="iconesForm" >
								<a class="modal" href="index2.php?option=com_sgrh&view=gerenciador&controller=gerenciador&task=buscarContatos&idPessoa=<?php echo $row->id ?>">
									<img alt="" src="components/com_sgrh/auxiliares/imagens/telephone.png" />
								</a>
							</div>
						</td>
						<td>
							<div class="iconesForm" >
								<a href ="<?php echo $linkEditar; ?>">
									<img alt="" src="components/com_sgrh/auxiliares/imagens/editarDados.png" />
								</a>
							</div>
						</td>
						<?php if ($this->user->gid == 25 ){?>
						<td>
							<div class="iconesForm" >
								<a href="<?php echo $linkDelete; ?>">
									<img alt="" src="components/com_sgrh/auxiliares/imagens/btnRemover.png" />
								</a>
							</div>

						</td>
						<?php } ?>
					</tr>
					<?php
				}
				?>
			</table>
		</div>

	</fieldset>

	<div class="clr"></div>
	<?php echo JHTML::_('form.token'); ?>
</form>